<template>
  <div class="container">
    <div class="left-box">
      
      <div class="body">
        <div class="title">AI辅助创作助手</div>
        <img src="../assets/undraw_typewriter_re_u9i2.svg"/>
      </div>
      <div class="footer">
        <div class="bq">@2023 Aanull 版权所有</div>
        <a href="https://beian.miit.gov.cn/" class="beian">ICP备案：京ICP证03173号</a>
      </div>
    </div>
    <div class="right-box">
      <div class="login-box">
        <div class="login-header">
          用户账号
        </div>
        <div class="account-input">
          <input v-model="account" type="text" placeholder="请输入用户账号"/>
          <input v-model="password" placeholder="请输入密码" type="password"/>
        </div>
        <a class="login-btn" @click="login()">登录</a>
      </div>
    </div>
  </div>
</template>

<script>


export default {
  name: 'waterworks-login',
  components: {},
  data () {
    return {
      account: '',
      password: ''
    }
  },
  methods: {
    login () {
      let sendInfo = {
        uid: this.account,
        password: this.password
      }
      this.$axios.post('/login', sendInfo).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.msg)
          const userInfo = {
            uid: res.data.uid,
            name: res.data.name
          }
          localStorage.setItem('userInfo', JSON.stringify(userInfo))
          this.$router.push({ path: '/pc/index' })
        } else {
          this.$message(res.data.msg)
        }

      }).catch(err => {
        this.$message.error(err)
      })
    }
  }
}
</script>
<style lang="less" scoped>
.container {
  display: flex;
  background-color: #fff;

  .left-box {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100vh;
    flex: 1;
    padding-left: 100px;

    .header {
      display: flex;
      margin-top: 40px;

      img {
        height: 35px;
        //width: 35px;
      }

      h1 {
        color: rgba(57, 145, 238, 1);
        font-size: 22px;
        margin-left: 15px;
      }
    }

    .body {
      //margin-top:60px;
      .title {
        color: rgba(51, 51, 51, 1);
        font-size: 30px;
        font-weight: 700;
        margin-left: 5px;
      }

      img {
        height: 320px;
        margin-top: 30px;
      }

    }

    .footer {
      //flex: 1;
      //margin-top: 60px;
      color: rgba(102, 102, 102, 1);
      font-size: 14px;

      a {
        display: block;
        color: rgba(102, 102, 102, 1);
        margin-top: 10px;
      }
    }
  }

  .right-box {
    position: relative;
    height: 100vh;
    width: 456px;
    background-color: var(--objectColor);
  }

  .login-box {
    display: block;
    width: 380px;
    padding: 15px 40px;
    position: absolute;
    left: -190px;
    top: 50%;
    transform: translate(0, -50%);
    background-color: #fff;
    box-shadow: 2px 1px 20px 5px rgba(18, 18, 18, 0.1);
    border-radius: 5px;

    .login-header {
      margin-top: 40px;
      text-align: center;
      font-size: 20px;
      color: var(--objectColor);
      font-weight: 700;
      border-bottom: 3px solid var(--objectColor);
      padding-bottom: 20px;

    }

    .account-input {
      margin: 40px 0;

      input {
        display: block;
        height: 40px;
        width: 100%;
        margin-top: 20px;
        padding-left: 15px;
        font-size: 14px;
        border: 1px solid rgba(214, 214, 214, 1);
        border-radius: 4px;
      }
    }

    .login-btn {
      display: flex;
      justify-content: center;
      align-items: center;
      color: #ffffff;
      background-color: var(--objectColor);
      height: 40px;
      width: 100%;
      border-radius: 27.5px;
      margin-top: 30px;
      margin-bottom: 70px;
      cursor: pointer;
    }
  }
}
</style>
